<?php
namespace app\common\service\api\service;
use app\common\service\api\interfaces\AdminApi;
use app\common\exception\TokenException;
use app\common\exception\LogicException;
use think\db\exception\DataNotFoundException;
class AdminApiService implements AdminApi{
    public function getAdminListPage(){
        $keyword = input('keyword');
        if (!empty($keyword)) {
            $where[] = ['login_account|name|tel|email', 'like', '%'.$keyword.'%'];
        }
        $where[] = ['admin_id', '>', 0];
        $list= app('admin_ability')->getListPage($where);
        if ($list->isEmpty()) {
            throw new DataNotFoundException(lang('DATA_NOT_FOUND'), 10006);
        } else {
            foreach ($list as &$vr) {
                $vr['head_img_url'] = $vr['head_img_url'];
            }
            $data['total'] =app('admin_ability')->getCount($where);
            $data['list'] = $list;
            return $data;
        }
        return $requestData;
    }
    public function saveAdminAdd(){
        $requestData = input();
        $requestData['status'] = 1;
        $result=app('admin_ability')->saveAdd($requestData);
        if ($result !== false) {
            return $result;
        } else {
            throw new LogicException(lang('SAVE_ERROR'), 10006);
        }
    }
    public function getAdminRow(){}
    public function saveAdminEdit(){}
    public function saveAdminDel(){}
    public function loginAdmin(){}
    public function loginShops(){}
    public function logoutAdmin(){}
    public function logoutShops(){}
    public function getAdminInfo(){}
    public function saveAdminInfo(){}
    public function resetPassword(){

    }
    public function checkAdminToken(){}
    public function checkShopsToken(){}
}